package de.szut.bomberman.gui.info;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;

import javax.swing.SwingConstants;

import de.szut.bomberman.gui.main.DefaultPanel;
import de.szut.bomberman.gui.main.GUIController;
import de.szut.bomberman.gui.mainmenu.MainMenuPanel;
import de.szut.bomberman.main.Controller;
import de.szut.gui.language.Languages;
import de.szut.gui.language.TranslatableComponent;
import de.szut.gui.language.TranslatableLabel;

public class InfoPanel extends DefaultPanel {

	public static final int STARTINGPOSITIONX = 40;
	public static final int STARTINGPOSITIONY = 100;
	
	private static final long serialVersionUID = -5160353797851689486L;
	
	private TranslatableLabel lblInformation;
	
	private ArrayList<TranslatableComponent> translatableComponents;
	
	public InfoPanel() {
		translatableComponents = new ArrayList<TranslatableComponent>();
		
		Languages.prepareComponent("info.InfoPanel.header", getHeader(), translatableComponents);
		Languages.prepareComponent("info.InfoPanel.return", getReturnButton(), translatableComponents);
		getReturnButton().addMouseListener(new MouseAdapter() {
			
			@Override
			public void mouseClicked(MouseEvent arg0) {
				Controller.getInstance().getGuiController().switchPanel(new MainMenuPanel());
			}
		});
		
		lblInformation = new TranslatableLabel();
		Languages.prepareComponent("info.InfoPanel.information", lblInformation, translatableComponents);
		lblInformation.setBounds(STARTINGPOSITIONX, STARTINGPOSITIONY, Controller.getInstance().getGuiController().getMainFrame().getWidth()-STARTINGPOSITIONX-5, Controller.getInstance().getGuiController().getMainFrame().getHeight()-STARTINGPOSITIONY-5);
		lblInformation.setForeground(GUIController.COMPONENTFOREGROUNDCOLOR);
		lblInformation.setFont(GUIController.COMPONENTFONT);
		lblInformation.setVerticalAlignment(SwingConstants.TOP);
		add(lblInformation);
		
		Controller.getInstance().getGuiController().getLanguages().translateListOfComponents(translatableComponents);
	}
}
